package com.lkwlw.tplms.system.action;

import java.util.List;

import com.lkwlw.tplms.system.dao.mapper.AuthorityMapper;
import com.lkwlw.tplms.system.dao.model.Authority;
import com.lkwlw.tplms.system.dao.model.AuthorityExample;
import com.opensymphony.xwork2.ActionSupport;

public class AddAuthorityAction extends ActionSupport {
	private static final long serialVersionUID = 2460420673489905477L;
	
	private AuthorityMapper authorityMapper;	
	private Authority authority;
	private List<Authority> authorityList;
	private String selectIds;
	
	public String execute(){
		
		return SUCCESS;
	}
	public String edit() throws Exception{
		
		return SUCCESS;
	}
	public String save() throws Exception {
		if (authority.getId() == null || authority.getId() == 0) {
			authorityMapper.insertSelective(authority);
		}else {
			authorityMapper.updateByPrimaryKey(authority);
		}
		authorityList = authorityMapper.selectByExample(new AuthorityExample());
		return SUCCESS;
	}
	
	public AuthorityMapper getAuthorityMapper() {
		return authorityMapper;
	}

	public void setAuthorityMapper(AuthorityMapper authorityMapper) {
		this.authorityMapper = authorityMapper;
	}

	public Authority getAuthority() {
		return authority;
	}

	public void setAuthority(Authority authority) {
		this.authority = authority;
	}

	public List<Authority> getAuthorityList() {
		return authorityList;
	}

	public void setAuthorityList(List<Authority> authorityList) {
		this.authorityList = authorityList;
	}

	public String getSelectIds() {
		return selectIds;
	}

	public void setSelectIds(String selectIds) {
		this.selectIds = selectIds;
	}

}
